package pojo.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.redis.core.index.PathBasedRedisIndexDefinition;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.Objects;

public class Good {

    private Long goodId;                    //商品id
    private String goodHref;                //商品详情链接（网上连接）
    private String goodName;                //商品名
    private Double goodPrice;               //商品价格
    private String goodShop;                //商品所属店铺
    private String goodImg;                 //商品图片路径
    private Integer goodCount;              //商品库存
    private String goodIcon;                //商品形式（自营。。。）
    @DateTimeFormat(pattern ="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createdTime;                //创建时间（入库时间）
    private int goodType=0;                 //商品种类（默认为0）
    private int goodUp;                     //商品上下架状态
    private int deleteType;                 //删除状态
    private Long shopId;
    private String shopName;

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public int getNewPages() {
        return newPages;
    }

    public void setNewPages(int newPages) {
        this.newPages = newPages;
    }

    public int getPages() {
        return pages;
    }

    public Good(Long goodId, String goodHref, String goodName, Double goodPrice, String goodShop, String goodImg, Integer goodCount, String goodIcon, Date createdTime, int goodType, int goodUp, int deleteType, Long shopId, int newPages, int pages) {
        this.goodId = goodId;
        this.goodHref = goodHref;
        this.goodName = goodName;
        this.goodPrice = goodPrice;
        this.goodShop = goodShop;
        this.goodImg = goodImg;
        this.goodCount = goodCount;
        this.goodIcon = goodIcon;
        this.createdTime = createdTime;
        this.goodType = goodType;
        this.goodUp = goodUp;
        this.deleteType = deleteType;
        this.shopId = shopId;
        this.newPages = newPages;
        this.pages = pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    private int newPages;                   //从第几个开始
    private int pages;                      //显示几条


    public int getDeleteType() {
        return deleteType;
    }

    public void setDeleteType(int deleteType) {
        this.deleteType = deleteType;
    }


    @Override
    public int hashCode() {
        return Objects.hash(goodId, goodHref, goodName, goodPrice, goodShop, goodImg, goodCount, goodIcon, createdTime, goodType, goodUp, deleteType, newPages, pages);
    }

    public Good() {
    }

    public Good(String goodHref, String goodName, Double goodPrice, String goodShop, String goodImg, String goodIcon) {
        this.goodHref = goodHref;
        this.goodName = goodName;
        this.goodPrice = goodPrice;
        this.goodShop = goodShop;
        this.goodImg = goodImg;
        this.goodIcon = goodIcon;
    }

    public Good(String goodHref, String goodName, Double goodPrice, String goodShop, String goodImg, String goodIcon, Date createdTime, int goodType) {
        this.goodHref = goodHref;
        this.goodName = goodName;
        this.goodPrice = goodPrice;
        this.goodShop = goodShop;
        this.goodImg = goodImg;
        this.goodIcon = goodIcon;
        this.createdTime = createdTime;
        this.goodType=goodType;
    }

    public Integer getGoodCount() {
        return goodCount;
    }

    public void setGoodCount(Integer goodCount) {
        this.goodCount = goodCount;
    }

    public Long getGoodId() {
        return goodId;
    }

    public void setGoodId(Long goodId) {
        this.goodId = goodId;
    }

    public String getGoodHref() {
        return goodHref;
    }

    public void setGoodHref(String goodHref) {
        this.goodHref = goodHref;
    }

    public String getGoodName() {
        return goodName;
    }

    public void setGoodName(String goodName) {
        this.goodName = goodName;
    }

    public Double getGoodPrice() {
        return goodPrice;
    }

    public void setGoodPrice(Double goodPrice) {
        this.goodPrice = goodPrice;
    }

    public String getGoodShop() {
        return goodShop;
    }

    public void setGoodShop(String goodShop) {
        this.goodShop = goodShop;
    }

    public String getGoodImg() {
        return goodImg;
    }

    public void setGoodImg(String goodImg) {
        this.goodImg = goodImg;
    }

    public String getGoodIcon() {
        return goodIcon;
    }

    public void setGoodIcon(String goodIcon) {
        this.goodIcon = goodIcon;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public int getGoodType() {
        return goodType;
    }

    public void setGoodType(int goodType) {
        this.goodType = goodType;
    }

    public int getGoodUp() {
        return goodUp;
    }

    public void setGoodUp(int goodUp) {
        this.goodUp = goodUp;
    }

    @Override
    public String toString() {
        return "Good{" +
                "goodId=" + goodId +
                ", goodHref='" + goodHref + '\'' +
                ", goodName='" + goodName + '\'' +
                ", goodPrice=" + goodPrice +
                ", goodShop='" + goodShop + '\'' +
                ", goodImg='" + goodImg + '\'' +
                ", goodCount=" + goodCount +
                ", goodIcon='" + goodIcon + '\'' +
                ", createdTime=" + createdTime +
                ", goodType=" + goodType +
                ", goodUp=" + goodUp +
                '}';
    }
}
